home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 13 / AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso / rexx / polar_to_rect.scrx < prev    next >
Text File  |  1994-11-16  |  683b  |  38 lines

  1. /*        SciCalc Scientific Calculator
  2.                 by Brian Savage
  3.  
  4.         Arexx script to convert polar coordinates to
  5.         cartesian coordinates.
  6.  
  7.         This script requires RexxMathLib.library
  8.  
  9. */
  10.  
  11. if ~show("l", "rexxmathlib.library") then
  12.     if ~addlib("rexxmathlib.library", 0, -30,0) then
  13.     do
  14.       address command
  15.       say  "Can't find RexxMathLib"
  16.     end
  17.  
  18.  
  19. options results
  20.  
  21. getreg 1                /*   theta (radians) -> from register #1   */
  22.  
  23. parse var result theta
  24.  
  25. getval                  /*   r -> displayed value                  */
  26.  
  27. parse var result r
  28.  
  29. putval r*cos(theta)     /* x -> displayed value                    */
  30.  
  31. putreg 1 r*sin(theta)   /* y -> returned in register 1               */
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.